var location = require("../../../../mybehaviors/location/location");

Component({
  behaviors: [location],

  properties: {
    params: {
      type: null,
    },
    data: {
      type: null,
    },
    is_url: {
      type: null,
    },
    search:{
      type:Boolean,
      value:true
    },
    tag:{
      type:String,
      value:"project_verification/VerificationProjectList"
    },
    addressValue:{
      type:String,
      value:""
    }
  },
  data: {
    address: "",
    point: {
      lat: "",
      lng: "",
    },
    city: "",
  }, // 私有数据，可用于模板渲染

  lifetimes: {
    // 生命周期函数，可以为函数，或一个在methods段中定义的方法名
    attached() {},
    moved() {},
    detached() {},
  },

  // 生命周期函数，可以为函数，或一个在methods段中定义的方法名
  attached() {}, // 此处attached的声明会被lifetimes字段中的声明覆盖
  ready() {
    this._getLocation((res) => {
      let address_on = wx.getStorageSync('address-point');
      this.setData({
        address:address_on.city
      });
    });
  },

  pageLifetimes: {
    // 组件所在页面的生命周期函数
    show() {},
    hide() {},
    resize() {},
  },

  methods: {

    tolocation() {
      wx.navigateTo({
        url: "/packageC/o2o/o2oLocation/o2oLocation?tag="+this.data.tag,
      });
      // if (this.data.data[0].home){
      //   wx.navigateTo({
      //     url: '/packageC/o2o/o2oLocation/o2oLocation?tag=home'
      //   });
      // }else if(this.properties.is_url){
      //   wx.navigateTo({
      //     url: '/packageC/o2o/o2oLocation/o2oLocation?tag=diy'
      //   });
      // }else{
      //   wx.navigateTo({
      //     url: '/packageC/o2o/o2oLocation/o2oLocation'
      //   });
      // }
    },
    tosearch() {
      if (!this.data.city) {
        wx.showToast({
          icon: "none",
          title: "请先选择城市",
          duration: 1000,
        });
        return;
      }
      wx.navigateTo({
        url: "/packageH/project_verification/SearchProject/SearchProject",
      });
    },
  },
});
